package com.wey.feign.fallback;

import com.wey.R;
import com.wey.feign.UserFeignClient;
import com.wey.handler.ExceotionHandler.MyException;
import com.wey.vo.UserVo;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignFallbackFactory implements FallbackFactory<UserFeignClient> {

    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public R<UserVo> querUser() {
               throw new MyException("调用失败",throwable);
            }
        };
    }
}
